 * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Arial', sans-serif;
        }
        
        body {
            width: 100%;
            height: 100vh;
            display: flex;
            flex-direction: column;
            background-color: #f5f5f5;
            color: #333;
        }
        
        /* 页面容器 */
        .page {
            width: 100%;
            height: 100%;
            display: none;
            flex-direction: column;
            position: absolute;
            top: 0;
            left: 0;
            background-color: #f5f5f5;
            align-items: center; /* 新增：水平居中 */
            justify-content: center; /* 新增：垂直居中 */
   
        }
        
        .page.active {
            display: flex;
        }
        
        /* 主菜单样式 */
        .main-menu {
            width: 100%;
            max-width: 500px; 
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        
        .game-title {
            font-size: 36px;
            font-weight: bold;
            color: #4a6fa5;
            margin-bottom: 40px;
        }
        
        .menu-btn {
            width: 80%;
            max-width: 300px;
            height: 50px;
            margin: 10px 0;
            background-color: #4a6fa5;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 18px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        .menu-btn:hover {
            background-color: #3a5a8f;
        }
        
        .menu-btn:disabled {
            background-color: #cccccc;
            cursor: not-allowed;
        }
        
        /* 难度选择菜单 */
        .difficulty-menu {
            width: 100%;
            max-width: 500px; 
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        
        .difficulty-btn {
            width: 80%;
            max-width: 300px;
            height: 60px;
            margin: 10px 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            background-color: #4a6fa5;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .difficulty-btn:hover {
            background-color: #3a5a8f;
        }
        
        .difficulty-level {
            font-size: 14px;
            color: rgba(255,255,255,0.8);
        }
        
        /* 关卡选择菜单 */
        .level-menu {
            width: 100%;
            max-width: 500px;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 20px;
            overflow-y: auto;
        }
        
        .level-title {
            font-size: 24px;
            font-weight: bold;
            color: #4a6fa5;
            margin-bottom: 20px;
        }
        
        .level-grid {
            width: 100%;
            max-width: 500px;
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 10px;
            margin-bottom: 20px;
        }
        
        .level-btn {
            aspect-ratio: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #4a6fa5;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .level-btn:hover {
            background-color: #3a5a8f;
        }
        
        .level-btn.completed {
            background-color: #4CAF50;
        }
        
        .level-btn.locked {
            background-color: #cccccc;
            cursor: not-allowed;
        }
        
        /* 游戏页面样式 */
        .game-container {
            width: 100%;
           max-width: 500px;
           height: 100%;
            display: flex;
            flex-direction: column;
            margin: 0 auto;
        }
        
        /* 游戏头部信息 */
        .game-header {
            width: 100%;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: white;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        .level-info {
            font-size: 16px;
            font-weight: bold;
            color: #4a6fa5;
        }
        
        .mistakes {
            font-size: 16px;
            color: #4a6fa5;
            display: flex;
            align-items: center;
        }
        
        .heart {
            color: red;
            margin: 0 2px;
        }
        
        .timer {
            font-family: monospace;
            font-size: 16px;
            color: #4a6fa5;
        }
        
        /* 棋盘容器 */
        .board-container {
            width: 100%;
            max-width: 500px;
            aspect-ratio: 1;
            margin: 20px auto;
            padding: 10px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        
        /* 数独棋盘 */
        .board {
            width: 100%;
            height: 100%;
            display: grid;
            grid-template-columns: repeat(9, 1fr);
            grid-template-rows: repeat(9, 1fr);
            gap: 1px;
            background-color: #aaa;
        }
        
        /* 单元格样式 */
        .cell {
            background-color: #e6f2ff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            cursor: pointer;
            user-select: none;
        }
        
        .cell.fixed {
            background-color: #f5f5e6;
            font-weight: bold;
        }
        
        .cell.highlighted {
            background-color: #cce0ff;
        }
        
        .cell.error {
            background-color: #ffcccc;
            animation: shake 0.5s;
        }
        
        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            20%, 60% { transform: translateX(-5px); }
            40%, 80% { transform: translateX(5px); }
        }
        
        /* 宫格粗边框 */
        .cell:nth-child(3n) {
            border-right: 2px solid #4a6fa5;
        }
        
        .cell:nth-child(9n) {
            border-right: none;
        }
        
        .cell:nth-child(n+19):nth-child(-n+27),
        .cell:nth-child(n+46):nth-child(-n+54) {
            border-bottom: 2px solid #4a6fa5;
        }
        
        /* 游戏控制按钮 */
        .game-controls {
            width: 100%;
            max-width: 500px;
            margin: 0 auto;
            padding: 10px;
            display: flex;
            justify-content: space-between;
        }
        
        .control-btn {
            padding: 8px 12px;
            background-color: #4a6fa5;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        .control-btn:hover {
            background-color: #3a5a8f;
        }
        
        .control-btn.highlighted {
            border: 2px solid #000;
        }
        
        /* 数字选择按钮 */
        .number-selector {
            width: 100%;
            max-width: 500px;
            margin: 10px auto;
            padding: 10px;
            display: grid;
            grid-template-columns: repeat(9, 1fr);
            gap: 5px;
        }
        
        .number-btn {
            aspect-ratio: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #4a6fa5;
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 1.2rem;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        .number-btn:hover {
            background-color: #3a5a8f;
        }
        
        /* 底部广告 */
        .ad-container {
            width: 100%;
            max-width: 500px;
            padding: 10px;
            margin: 20px auto 0; /* 水平居中 */
            background-color: #f0f0f0;
            text-align: center;
            font-size: 12px;
            color: #666;
            border-top: 1px solid #ddd;
        }
        
        /* 底部导航 */
        .bottom-nav {
            width: 100%;
            max-width: 500px;
            height: 60px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            background-color: white;
            border-top: 1px solid #ddd;
             margin: 0 auto; /* 水平居中 */
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #666;
            font-size: 12px;
            cursor: pointer;
        }
        
        .nav-item.active {
            color: #4a6fa5;
        }
        
        /* 游戏结束弹窗 */
        .game-over {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 80%;
            max-width: 400px;
            padding: 20px;
            background-color: white;
            border-radius: 10px;
            text-align: center;
            z-index: 20;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
            display: none;
        }
        
        .game-over.active {
            display: block;
        }
        
        .game-over h1 {
            color: #4a6fa5;
            margin-bottom: 20px;
        }
        
        .game-over h2 {
            margin: 10px 0;
            color: #333;
        }
        
        .game-over h3 {
            margin: 10px 0;
            color: #666;
        }
        
        /* 遮罩层 */
        .overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            z-index: 10;
            display: none;
        }
        
        .overlay.active {
            display: block;
        }
        
        /* 返回按钮 */
        .back-btn {
            position: absolute;
            top: 15px;
            left: 15px;
            background-color: #4a6fa5;
            color: white;
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            font-size: 18px;
            cursor: pointer;
            z-index: 20;
        }
        
        /* 响应式调整 */
        @media (max-width: 500px) {
            .cell {
                font-size: 1.2rem;
            }
            .control-btn {
                padding: 6px 8px;
                font-size: 12px;
            }
            .number-btn {
                font-size: 1rem;
            }

            .page {
        padding: 10px;
    }
    
            .main-menu, 
            .difficulty-menu, 
            .level-menu,
            .game-container,
            .board-container,
            .game-controls,
            .number-selector,
            .ad-container,
            .bottom-nav 
   {
        max-width: 100%;
    }
        }
        .number-btn.completed {
    background-color: #cccccc;
    cursor: not-allowed;
}
